const STOC = {
	GAME_MSG : 0x1,				// byte array
	ERROR_MSG : 0x2,			// STOC_ErrorMsg
	SELECT_HAND : 0x3,			// no data
	SELECT_TP : 0x4,			// no data
	HAND_RESULT : 0x5,			// STOC_HandResult
	TP_RESULT : 0x6,			// reserved
	CHANGE_SIDE : 0x7,			// no data
	WAITING_SIDE : 0x8,			// no data
	DECK_COUNT : 0x9,			// int16_t[6]
	CREATE_GAME : 0x11,			// reserved
	JOIN_GAME : 0x12,			// STOC_JoinGame
	TYPE_CHANGE : 0x13,			// STOC_TypeChange
	LEAVE_GAME : 0x14,			// reserved
	DUEL_START : 0x15,			// no data
	DUEL_END : 0x16,			// no data
	REPLAY : 0x17,				// ExtendedReplayHeader + byte array
	TIME_LIMIT : 0x18,			// STOC_TimeLimit
	CHAT : 0x19,				// uint16_t + uint16_t array
	HS_PLAYER_ENTER : 0x20,		// STOC_HS_PlayerEnter
	HS_PLAYER_CHANGE : 0x21,	// STOC_HS_PlayerChange
	HS_WATCH_CHANGE : 0x22,		// STOC_HS_WatchChange
	TEAMMATE_SURRENDER : 0x23,	// no data
	FIELD_FINISH : 0x30,
	SRVPRO_ROOMLIST : 0x31
};

const CTOS = {
	RESPONSE : 0x1,				// byte array
	UPDATE_DECK : 0x2,			// CTOS_DeckData
	HAND_RESULT : 0x3,			// CTOS_HandResult
	TP_RESULT : 0x4,			// CTOS_TPResult
	PLAYER_INFO : 0x10,			// CTOS_PlayerInfo
	CREATE_GAME : 0x11,			// CTOS_CreateGame
	JOIN_GAME : 0x12,			// CTOS_JoinGame
	LEAVE_GAME : 0x13,			// no data
	SURRENDER : 0x14,			// no data
	TIME_CONFIRM : 0x15,		// no data
	CHAT : 0x16,				// uint16_t array
	EXTERNAL_ADDRESS : 0x17,	// CTOS_ExternalAddress
	HS_TODUELIST : 0x20,		// no data
	HS_TOOBSERVER : 0x21,		// no data
	HS_READY : 0x22,			// no data
	HS_NOTREADY : 0x23,			// no data
	HS_KICK : 0x24,				// CTOS_Kick
	HS_START : 0x25,			// no data
	REQUEST_FIELD : 0x30
};

const LOCATION = {
	NONE : 0,
	DECK : 0x01,
	HAND : 0x02,
	MZONE : 0x04,
	SZONE : 0x08,
	GRAVE : 0x10,
	REMOVED : 0x20,
	EXTRA : 0x40,
	OVERLAY : 0x80,
	ONFIELD : 0,
	FZONE : 0x100,
	PZONE : 0x200,
	ALL : 0xffff
};

LOCATION.ONFIELD = (LOCATION.MZONE | LOCATION.SZONE);

const MSG = {
	RETRY : 1,
	HINT : 2,
	WAITING : 3,
	START : 4,
	WIN : 5,
	UPDATE_DATA : 6,
	UPDATE_CARD : 7,
	REQUEST_DECK : 8,
	SELECT_BATTLECMD : 10,
	SELECT_IDLECMD : 11,
	SELECT_EFFECTYN : 12,
	SELECT_YESNO : 13,
	SELECT_OPTION : 14,
	SELECT_CARD : 15,
	SELECT_CHAIN : 16,
	SELECT_PLACE : 18,
	SELECT_POSITION : 19,
	SELECT_TRIBUTE : 20,
	SELECT_COUNTER : 22,
	SELECT_SUM : 23,
	SELECT_DISFIELD : 24,
	SORT_CARD : 25,
	SELECT_UNSELECT_CARD : 26,
	CONFIRM_DECKTOP : 30,
	CONFIRM_CARDS : 31,
	SHUFFLE_DECK : 32,
	SHUFFLE_HAND : 33,
	REFRESH_DECK : 34,
	SWAP_GRAVE_DECK : 35,
	SHUFFLE_SET_CARD : 36,
	REVERSE_DECK : 37,
	DECK_TOP : 38,
	SHUFFLE_EXTRA : 39,
	NEW_TURN : 40,
	NEW_PHASE : 41,
	CONFIRM_EXTRATOP : 42,
	MOVE : 50,
	POS_CHANGE : 53,
	SET : 54,
	SWAP : 55,
	FIELD_DISABLED : 56,
	SUMMONING : 60,
	SUMMONED : 61,
	SPSUMMONING : 62,
	SPSUMMONED : 63,
	FLIPSUMMONING : 64,
	FLIPSUMMONED : 65,
	CHAINING : 70,
	CHAINED : 71,
	CHAIN_SOLVING : 72,
	CHAIN_SOLVED : 73,
	CHAIN_END : 74,
	CHAIN_NEGATED : 75,
	CHAIN_DISABLED : 76,
	CARD_SELECTED : 80,
	RANDOM_SELECTED : 81,
	BECOME_TARGET : 83,
	DRAW : 90,
	DAMAGE : 91,
	RECOVER : 92,
	EQUIP : 93,
	LPUPDATE : 94,
	UNEQUIP : 95,
	CARD_TARGET : 96,
	CANCEL_TARGET : 97,
	PAY_LPCOST : 100,
	ADD_COUNTER : 101,
	REMOVE_COUNTER : 102,
	ATTACK : 110,
	BATTLE : 111,
	ATTACK_DISABLED : 112,
	DAMAGE_STEP_START : 113,
	DAMAGE_STEP_END : 114,
	MISSED_EFFECT : 120,
	BE_CHAIN_TARGET : 121,
	CREATE_RELATION : 122,
	RELEASE_RELATION : 123,
	TOSS_COIN : 130,
	TOSS_DICE : 131,
	ROCK_PAPER_SCISSORS : 132,
	HAND_RES : 133,
	ANNOUNCE_RACE : 140,
	ANNOUNCE_ATTRIB : 141,
	ANNOUNCE_CARD : 142,
	ANNOUNCE_NUMBER : 143,
	CARD_HINT : 160,
	TAG_SWAP : 161,
	RELOAD_FIELD : 162,			// Debug.ReloadFieldEnd() or query_field_info()
	AI_NAME : 163,				// Debug.AIName()
	SHOW_HINT : 164,			// Debug.ShowHint()
	PLAYER_HINT : 165,
	MATCH_KILL : 170,
	CUSTOM_MSG : 180,

	RESET_TIME : 221
};

const ERROR = {
	JOINERROR : 0x1,
	DECKERROR : 0x2,
	SIDEERROR : 0x3,
	VERERROR : 0x4,
	LFLIST : 0x1,
	OCGONLY : 0x2,
	TCGONLY : 0x3,
	UNKNOWNCARD : 0x4,
	CARDCOUNT : 0x5,
	MAINCOUNT : 0x6,
	EXTRACOUNT : 0x7,
	SIDECOUNT : 0x8,
	NOTAVAIL : 0x9
};

const  PLAYERCHANGE = {
	OBSERVE : 0x8,
	READY : 0x9,
	NOTREADY : 0xa,
	LEAVE : 0xb
};

const HINT = {
    EVENT : 1,
    MESSAGE : 2,
    SELECTMSG : 3,
    OPSELECTED : 4,
    EFFECT : 5,
    RACE : 6,
    ATTRIB : 7,
    CODE : 8,
    NUMBER : 9,
    CARD : 10,
    ZONE : 11,
	DIALOG : 24
};

const POS = {
	NONE : 0x0,
	FACEUP_ATTACK : 0x1,
	FACEDOWN_ATTACK : 0x2,
	FACEUP_DEFENSE : 0x4,
	FACEDOWN_DEFENSE : 0x8,
	FACEUP : 0x5,
	FACEDOWN : 0xa,
	ATTACK : 0x3,
	DEFENSE : 0xc
};

const QUERY = {
	CODE : 0x1,
	POSITION : 0x2,
	ALIAS : 0x4,
	TYPE : 0x8,
	LEVEL : 0x10,
	RANK : 0x20,
	ATTRIBUTE : 0x40,
	RACE : 0x80,
	ATTACK : 0x100,
	DEFENSE : 0x200,
	BASE_ATTACK : 0x400,
	BASE_DEFENSE : 0x800,
	REASON : 0x1000,
	REASON_CARD : 0x2000,
	EQUIP_CARD : 0x4000,
	TARGET_CARD : 0x8000,
	OVERLAY_CARD : 0x10000,
	COUNTERS : 0x20000,
	OWNER : 0x40000,
	STATUS : 0x80000,
	LSCALE : 0x200000,
	RSCALE : 0x400000,
	LINK : 0x800000
};

const PHASE = {
	DRAW : 0x01,
	STANDBY : 0x02,
	MAIN1 : 0x04,
	BATTLE_START : 0x08,
	BATTLE_STEP : 0x10,
	DAMAGE : 0x20,
	DAMAGE_CAL : 0x40,
	BATTLE : 0x80,
	MAIN2 : 0x100,
	END : 0x200
};

const COMMAND = {
	ACTIVATE : 0x0001,
	SUMMON : 0x0002,
	SPSUMMON : 0x0004,
	MSET : 0x0008,
	SSET : 0x0010,
	REPOS : 0x0020,
	ATTACK : 0x0040,
	LIST : 0x0080,
	OPERATION : 0x0100,
	RESET : 0x0200,
	//CUSTOM
	PSUMMON : 0x10000000,
	SCALE : 0x20000000,
};

const EDESC = {
	NONE : 0,
	OPERATION : 1,
	RESET : 2
};


export { CTOS, STOC, LOCATION, MSG, ERROR, PLAYERCHANGE, HINT, POS, QUERY, PHASE, COMMAND, EDESC };